<?php
namespace app\forum\controller;
use app\forum\controller\SiteController;
/**
 * 单页面
 */

class PageController extends SiteController {

	/**
     * 主页
     */
    public function index(){
        $pageId = request('get.page_id',0,'intval');
        if (empty($pageId)) {
            $this->error404();
        }
        //获取板块信息
        $model = target('forum/Page');
        if(!empty($pageId)){
            $pageInfo = $model->getInfo($pageId);
        }else{
            $this->error404();
        }
        //信息判断
        if(empty($pageInfo)){
            $this->error404();
        }
        $pageInfo['content'] = \app\forum\util\Ubb::ubbToHtml($pageInfo['content']);
        $this->crumb[] = array('url'=>url('index',array('page_id'=>$pageId)),'name'=>$pageInfo['title']);
        $this->assign('pageInfo', $pageInfo);
        $this->siteDisplay();
    }
}